<?php
/**
 * CK 开发框架
 * User: Clake
 * Date: 15/6/22
 * Time: 00:52
 */

namespace CK\Core;


class Component extends Base{
    private static $_instance = [];

    /**
     * @param null $conf
     *
     * @return static
     */
    public static function inst($conf=null) {
        $class = get_called_class();
        if (!isset(self::$_instance[$class])) {
            self::$_instance[$class] = new $class($conf);
        }
        return self::$_instance[$class];
    }

    /**
     * 得到当前组件的配置文件
     * @return null|array
     */
    protected function getConfig() {
        $class = get_called_class();
        return C('component.'.$class);
    }
}